<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">

    <common-head></common-head>

  </div>
  <script src="./vue.js"></script>
  <script>
    const CommonLogo = {
      template: `
            <div>
              <h3>这是子组件</h3>  
              {{ msg2 }}
            </div>
          `,
      data() {
        return {
          msg2: '这是子组件自己的数据'
        }
      }
    }
    const CommonHead = {
      template: `
        <div>
          <h2>公共头部组件</h2>   
          <common-logo></common-logo>
        </div>
      `,
      data() {
        return {
          msg: '父组件中的数据'
        }
      },
      // config中定义components属性
      components: {
        // 属性名就是组件名命名方式同 全局组件
        CommonLogo: CommonLogo
      }
    }
    Vue.component('CommonHead',CommonHead)
    const vm = new Vue({
      el: '#app'
    })

  </script>
</body>

</html>